package com.genia.toolbox.projects.sample_ws_trampo.war.ws.interceptor;

import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;

public class CatchInInterceptor extends AbstractPhaseInterceptor<Message>{

    private int limit = 100 * 1024;

    public CatchInInterceptor() {
        super(Phase.RECEIVE);
    }

    public CatchInInterceptor(String phase) {
        super(phase);
    }

    public CatchInInterceptor(int lim) {
        this();
        limit = lim;
    }

    public void setLimit(int lim) {
        limit = lim;
    }

    public int getLimit() {
        return limit;
    }

    public void handleMessage(Message message) throws Fault {
    	ReadInInterceptor rii = new ReadInInterceptor(message, limit);
    	rii.logging();
    }
}